package org.spider.entity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@ApiModel(
        description = "认证信息"
)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AuthInfo {
    @ApiModelProperty("令牌")
    private String accessToken;
    @ApiModelProperty("令牌类型")
    private String tokenType;
    @ApiModelProperty("刷新令牌")
    private String refreshToken;
    @ApiModelProperty("用户ID")
    @JsonSerialize(
            using = ToStringSerializer.class
    )
    private Long userId;
    @ApiModelProperty("租户ID")
    private String tenantId;
    @ApiModelProperty("第三方系统ID")
    private String oauthId;
    @ApiModelProperty("头像")
    private String avatar = "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png";
    @ApiModelProperty("角色名")
    private String authority;
    @ApiModelProperty("用户名")
    private String userName;
    @ApiModelProperty("账号名")
    private String account;
    @ApiModelProperty("过期时间")
    private long expiresIn;
    @ApiModelProperty("许可证")
    private String license = "powered by spider";

    @Override
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof AuthInfo)) {
            return false;
        } else {
            AuthInfo other = (AuthInfo) o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getExpiresIn() != other.getExpiresIn()) {
                return false;
            } else {
                label145:
                {
                    Object this$userId = this.getUserId();
                    Object other$userId = other.getUserId();
                    if (this$userId == null) {
                        if (other$userId == null) {
                            break label145;
                        }
                    } else if (this$userId.equals(other$userId)) {
                        break label145;
                    }

                    return false;
                }

                Object this$accessToken = this.getAccessToken();
                Object other$accessToken = other.getAccessToken();
                if (this$accessToken == null) {
                    if (other$accessToken != null) {
                        return false;
                    }
                } else if (!this$accessToken.equals(other$accessToken)) {
                    return false;
                }

                Object this$tokenType = this.getTokenType();
                Object other$tokenType = other.getTokenType();
                if (this$tokenType == null) {
                    if (other$tokenType != null) {
                        return false;
                    }
                } else if (!this$tokenType.equals(other$tokenType)) {
                    return false;
                }

                label124:
                {
                    Object this$refreshToken = this.getRefreshToken();
                    Object other$refreshToken = other.getRefreshToken();
                    if (this$refreshToken == null) {
                        if (other$refreshToken == null) {
                            break label124;
                        }
                    } else if (this$refreshToken.equals(other$refreshToken)) {
                        break label124;
                    }

                    return false;
                }

                Object this$tenantId = this.getTenantId();
                Object other$tenantId = other.getTenantId();
                if (this$tenantId == null) {
                    if (other$tenantId != null) {
                        return false;
                    }
                } else if (!this$tenantId.equals(other$tenantId)) {
                    return false;
                }

                Object this$oauthId = this.getOauthId();
                Object other$oauthId = other.getOauthId();
                if (this$oauthId == null) {
                    if (other$oauthId != null) {
                        return false;
                    }
                } else if (!this$oauthId.equals(other$oauthId)) {
                    return false;
                }

                label103:
                {
                    Object this$avatar = this.getAvatar();
                    Object other$avatar = other.getAvatar();
                    if (this$avatar == null) {
                        if (other$avatar == null) {
                            break label103;
                        }
                    } else if (this$avatar.equals(other$avatar)) {
                        break label103;
                    }

                    return false;
                }

                Object this$authority = this.getAuthority();
                Object other$authority = other.getAuthority();
                if (this$authority == null) {
                    if (other$authority != null) {
                        return false;
                    }
                } else if (!this$authority.equals(other$authority)) {
                    return false;
                }

                label89:
                {
                    Object this$userName = this.getUserName();
                    Object other$userName = other.getUserName();
                    if (this$userName == null) {
                        if (other$userName == null) {
                            break label89;
                        }
                    } else if (this$userName.equals(other$userName)) {
                        break label89;
                    }

                    return false;
                }

                Object this$account = this.getAccount();
                Object other$account = other.getAccount();
                if (this$account == null) {
                    if (other$account != null) {
                        return false;
                    }
                } else if (!this$account.equals(other$account)) {
                    return false;
                }

                Object this$license = this.getLicense();
                Object other$license = other.getLicense();
                if (this$license == null) {
                    if (other$license == null) {
                        return true;
                    }
                } else if (this$license.equals(other$license)) {
                    return true;
                }

                return false;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof AuthInfo;
    }

    @Override
    public int hashCode() {
        int result = 1;
        long $expiresIn = this.getExpiresIn();
        result = result * 59 + (int) ($expiresIn >>> 32 ^ $expiresIn);
        Object $userId = this.getUserId();
        result = result * 59 + ($userId == null ? 43 : $userId.hashCode());
        Object $accessToken = this.getAccessToken();
        result = result * 59 + ($accessToken == null ? 43 : $accessToken.hashCode());
        Object $tokenType = this.getTokenType();
        result = result * 59 + ($tokenType == null ? 43 : $tokenType.hashCode());
        Object $refreshToken = this.getRefreshToken();
        result = result * 59 + ($refreshToken == null ? 43 : $refreshToken.hashCode());
        Object $tenantId = this.getTenantId();
        result = result * 59 + ($tenantId == null ? 43 : $tenantId.hashCode());
        Object $oauthId = this.getOauthId();
        result = result * 59 + ($oauthId == null ? 43 : $oauthId.hashCode());
        Object $avatar = this.getAvatar();
        result = result * 59 + ($avatar == null ? 43 : $avatar.hashCode());
        Object $authority = this.getAuthority();
        result = result * 59 + ($authority == null ? 43 : $authority.hashCode());
        Object $userName = this.getUserName();
        result = result * 59 + ($userName == null ? 43 : $userName.hashCode());
        Object $account = this.getAccount();
        result = result * 59 + ($account == null ? 43 : $account.hashCode());
        Object $license = this.getLicense();
        result = result * 59 + ($license == null ? 43 : $license.hashCode());
        return result;
    }
}